how to split a name js

66

how to split a name js -

var firstName = fullName.split(' ').slice(0, -1).join(' ');
var lastName = fullName.split(' ').slice(-1).join(' ');

Comments

Submit
0 Comments